package com.qf.zyh.web.controller;

import com.qf.zyh.common.ResponseResult;
import com.qf.zyh.common.ResultType;
import com.qf.zyh.entity.AppInfo;
import com.qf.zyh.entity.Recharge;
import com.qf.zyh.services.RechargeServices;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/recharge")
public class RechargeController {
    @Autowired
    private RechargeServices rechargeServices;
    @RequestMapping("/table")
    public ResultType table(@RequestParam(defaultValue = "1") Integer page,@RequestParam(defaultValue = "10") Integer limit){
        return rechargeServices.table(page,limit);
    }
    @RequestMapping("/del")
    public ResponseResult delre(Integer[] ids){
        try {
            return rechargeServices.delre(ids);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return ResponseResult.getFail("删除错误啦");
    }
    @RequestMapping("/add")
    public ResponseResult addre(Recharge r){
        try {
            return rechargeServices.addre(r);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return ResponseResult.getFail("添加错误啦");
    }
    @RequestMapping("/update")
    public ResponseResult updatere(Recharge r){
        try {
            return rechargeServices.updatere(r);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return ResponseResult.getFail("修改错误啦");
    }
}
